Fortran mode is meant for editing fixed form (and also tab
format) source code (normally Fortran 77). For editing more
modern free-form source code (Fortran 90, 95, 2003, 2008), use
F90 mode (f90-mode). Emacs normally uses Fortran
mode for files with extension ‘.f’,
‘.F’ or ‘.for’,
and F90 mode for the extensions ‘.f90’,
‘.f95’, ‘.f03’
and ‘.f08’. Customize
auto-mode-alist to add more extensions. GNU Fortran
supports both free and fixed form. This manual mainly documents
Fortran mode, but the corresponding F90 mode features are
mentioned when relevant.
Fortran mode provides special motion commands for Fortran statements and subprograms, and indentation commands that understand Fortran conventions of nesting, line numbers and continuation statements. Fortran mode has support for Auto Fill mode that breaks long lines into proper Fortran continuation lines. Fortran mode also supports Hideshow minor mode (see Hideshow), and Imenu (see Imenu).
Special commands for comments are provided because Fortran comments are unlike those of other languages. Built-in abbrevs optionally save typing when you insert Fortran keywords.
Use M-x fortran-mode to switch to this major mode.
This command runs the hook fortran-mode-hook. See
Hooks.
| • Motion: | Moving point by statements or subprograms. | |
| • Indent: | Indentation commands for Fortran. | |
| • Comments: | Inserting and aligning comments. | |
| • Autofill: | Auto fill support for Fortran. | |
| • Columns: | Measuring columns for valid Fortran. | |
| • Abbrev: | Built-in abbrevs for Fortran keywords. |